package com.iceberg.adgt.domain;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author David
 */
final class ArchitectureMapper {

	private ArchitectureMapper() {

	}

	public static ArchitectureDTO getArchitectureDTO(Architecture architecture) {
		ArchitectureDTO dto = new ArchitectureDTO();

		dto.setName(architecture.getName());
		dto.setAuthor(architecture.getAuthor());

		Map<String, LayerDTO> layers = new LinkedHashMap<String, LayerDTO>();
		for (Layer layer : architecture.getLayerMap().values()) {
			layers.put(layer.getName(), LayerMapper.getLayerDTO(layer));
		}

		dto.setLayers(layers);

		return dto;
	}
}
